﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Net;
using System.ServiceModel.Channels;
using System.ServiceModel;

namespace SmartSpace.WpfShell
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private static CookieContainer _cookieContainer = new CookieContainer();
        public App()
        {
            //WPF_hl_17xy_cn.HttpClient client = WPF_hl_17xy_cn.HttpClient.BeginSession("ss");
            //client.Get("http://localhost:4701/login.aspx"); 
            ////client.Get("http://localhost:4701/login.aspx");
            //_cookieContainer = client.Cookie;
        }

        //static ServiceRef.SsWebService client = null;
        static ServiceRef.SsWebService client = null;
        public static ServiceRef.SsWebService GetProxy()
        {
            //if (client == null)
            //{
            //    BasicHttpBinding binding = new BasicHttpBinding();
            //    binding.AllowCookies = true;
            //    client = new ServiceRef.SsWebServiceSoapClient(
            //        binding,
            //        new EndpointAddress("http://localhost:4701/SsWebService.asmx"));
            //}
            //client.CookieContainer = _cookieContainer;
            if (client != null)
            {
                _cookieContainer = client.CookieContainer;
            }
            client = new ServiceRef.SsWebService();
            client.CookieContainer = _cookieContainer;
            return client;
        }
    }
}
